﻿<UserControl x:Class="Samba.Presentation.Terminal.DepartmentSelectorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:FlexButton="clr-namespace:FlexButton;assembly=FlexButton" mc:Ignorable="d" 
             d:DesignHeight="320" d:DesignWidth="240">
    <Grid>
        <ItemsControl ItemsSource="{Binding Departments}" 
                 HorizontalContentAlignment="Stretch">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="1" VerticalAlignment="Top"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <FlexButton:FlexButton 
                        VerticalAlignment="Stretch" Content="{Binding Name}" 
                        Command="{Binding DataContext.SelectDepartmentCommand,RelativeSource={RelativeSource AncestorType=ItemsControl,Mode=FindAncestor}}"
                        CommandParameter="{Binding}">
                    </FlexButton:FlexButton>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
